//
//  UIButtonItem+extension.swift
//  Weibo
//
//  Created by lzing on 16/3/24.
//  Copyright © 2016年 lzing. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    ///  creatBarButtonItem
    convenience init(imageName: String, target: AnyObject?, action: Selector) {
        let button = UIButton()
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setImage(UIImage(named: "\(imageName)_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
        button.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        self.init(customView:button)
    }
}